#include<cstdio>
using namespace std;
void ninety_five();
void ninety_six();
void setc(unsigned int var);
void setb(unsigned int var);
void setbc(unsigned int var);

unsigned int logo[64];
int stack_top=0;
unsigned int de=4;
unsigned int hl=0x8010;
unsigned int a=0;
unsigned int b=0;
unsigned int c=0;
unsigned int bc=0;

int main() {
    unsigned int logo_temp[] = {0x00,0x00,0x00,0x00,0xce, 0xed, 0x66, 0x66, 0xcc, 0x0d,
                                                    0x00, 0x0b, 0x03, 0x73, 0x00, 0x83,
                                                    0x00, 0x0c, 0x00, 0x0d, 0x00, 0x08,
                                                    0x11, 0x1f, 0x88, 0x89, 0x00, 0x0e,
                                                    0xdc, 0xcc, 0x6e, 0xe6, 0xdd, 0xdd,
                                                    0xd9, 0x99, 0xbb, 0xbb, 0x67, 0x63,
                                                    0x6e, 0x0e, 0xec, 0xcc, 0xdd, 0xdc,
                                                    0x99, 0x9f, 0xbb, 0xb9, 0x33, 0x3e};
    for(int i=0;i<52;i++) {
        logo[i]=logo_temp[i];
    }
    while(de<0x34) {
        a=logo[de];
        printf("a=0x%02x\n",a);
        ninety_five();
        ninety_six();
        de++;
    }
    return 0;
}

void ninety_five() {
    printf("95\n");
    setc(a);
    ninety_six();
}

void ninety_six() {
    printf("96\n");
    setb(0x04);
    while(b>0) {
        stack_top=bc;
        setc(c<<(1));
        a<<=(1);
        a&=0xFF;
        setbc(stack_top);
        stack_top=0;
        setc(c<<(1));
        a<<=(1);
        a&=0xFF;
        setb(b-1);
    }
    printf("Setting %04x to %02x\n",hl,a);
    hl++;
    printf("Setting %04x to %02x\n",hl,a);
    hl++;
}

void setc(unsigned int var) {
    c=(var&0xFF);
    bc=((bc&0xFF00)|c);
}

void setb(unsigned int var) {
    b=(var&0xFF);
    bc=((bc&0xFF)|(b<<(8)));
}

void setbc(unsigned int var) {
    bc=(var&0xFFFF);
    b=(bc>>(8));
    c=(bc&0xFF);
}
